import java.util.Arrays;

public class Test7 {

    public static void main(String[] args) {
        int[] a={1,1,1,10};
        int i=0,j=2;
        a=swap(a,i,j);
    }

    public static int[] swap(int[] a,int i,int j){
        int[] b= Arrays.copyOf(a,a.length);
        int tmp=b[i];
        b[i]=b[j];
        b[j]=tmp;

        return b;

    }
}
